package face.pay.web.file;

import face.pay.entity.UserInfo;
import face.pay.security.annotation.CurrentUser;
import face.pay.util.FaceFileUtils;
import face.pay.util.ResultMessage;
import face.pay.web.file.service.IfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;

/**
 * @Auther: zkj
 * @Date: 2019/8/23 14:12
 * @Description:
 */
@RestController
@RequestMapping("/file_info")
public class FileController {

    @Autowired
    IfileService ifileService;


    /**
     * 登录用户 传输自己的图片 切
     * 只是单纯的保存图片
     * @param file
     * @param loginUser
     * @param mchUserId
     * @return
     * @throws Exception
     */
    @RequestMapping("/upload")
    public ResultMessage upload(@RequestParam("file") MultipartFile file, @CurrentUser  UserInfo loginUser,Integer mchUserId) throws  Exception{
        return  ifileService.upload(file,loginUser);
    }
}
